<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta http-equiv="cache-control" content="no-cache">
<title>Genivia - The smdevp signed message digest engine</title>
<link href="genivia_tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="genivia_content.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="top">
 <div id="titlearea">
  <table height="72px" width="100%" cellspacing="0" cellpadding="0">
   <tbody>
    <tr>
     <td width="10%">&nbsp;</td>
     <td width="175px"><a href="https://www.genivia.com"><img alt="Genivia" src="GeniviaLogo2_trans_noslogan.png"/></a></td>
     <td class="tab_home"><a href="https://www.genivia.com">Home</a></td>
     <td class="tab_home"><a href="https://www.genivia.com/docs.html">Documentation</a></td>
     <td>
      <div style="float: right; font-size: 18px; font-weight: bold;">The smdevp signed message digest engine</div>
      <br>
      <div style="float: right; font-size: 10px;">updated Thu Nov 19 2020 by Robert van Engelen</div>
     </td>
     <td width="10%">&nbsp;</td>
    </tr>
   </tbody>
  </table>
 </div>
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">The smdevp signed message digest engine </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>The gSOAP smdevp engine computes signed/unsigned message digests over any type of data using the EVP interface of OpenSSL. It currently supports MD5, SHA1/224/256/384/512, HMAC_SHA1/224/256/384/512, DSA_SHA1/224256/384/512, and RSA_SHA1/224/256/384/512.</p>
<p>A digest or signature algorithm is selected with one the following:</p>
<ul>
<li><a class="el" href="smdevp_8h.html#a27e3ed779342e2ff2c377cde6252b6a1">SOAP_SMD_HMAC_MD5</a> to compute HMAC-MD5 message authentication code</li>
<li><a class="el" href="smdevp_8h.html#a7d00704c43ee044926905cd327a712ef">SOAP_SMD_HMAC_SHA1</a> to compute HMAC-SHA1 message authentication code</li>
<li><a class="el" href="smdevp_8h.html#a0a03fa407c392d53e3e6609032c69a19">SOAP_SMD_HMAC_SHA224</a> to compute HMAC-SHA224 message authentication code</li>
<li><a class="el" href="smdevp_8h.html#a561d6c47f122626acb2f36bdabdc07e6">SOAP_SMD_HMAC_SHA256</a> to compute HMAC-SHA256 message authentication code</li>
<li><a class="el" href="smdevp_8h.html#a5928fa6c9c366857ffb96e70e6e04609">SOAP_SMD_HMAC_SHA384</a> to compute HMAC-SHA384 message authentication code</li>
<li><a class="el" href="smdevp_8h.html#a0eaedca857ff22ca7e2290e3ad67a184">SOAP_SMD_HMAC_SHA512</a> to compute HMAC-SHA512 message authentication code</li>
<li><a class="el" href="smdevp_8h.html#a66e616b88f16506cfad0e9f05445d130">SOAP_SMD_DGST_MD5</a> to compute MD5 128-bit digests</li>
<li><a class="el" href="smdevp_8h.html#ad8bbfdd0e7b1656123d888bf86a516e9">SOAP_SMD_DGST_SHA1</a> to compute SHA1 160-bit digests</li>
<li><a class="el" href="smdevp_8h.html#ac71cb6c0aa60f9210348bbdb4a678019">SOAP_SMD_DGST_SHA224</a> to compute SHA224 224-bit digests</li>
<li><a class="el" href="smdevp_8h.html#af2d675e87ba654125c052235dd97e206">SOAP_SMD_DGST_SHA256</a> to compute SHA256 256-bit digests</li>
<li><a class="el" href="smdevp_8h.html#ac61bc8dde95147651154fcdb2d833c06">SOAP_SMD_DGST_SHA384</a> to compute SHA384 384-bit digests</li>
<li><a class="el" href="smdevp_8h.html#af62441bd65c41931d4d2db07511d3c85">SOAP_SMD_DGST_SHA512</a> to compute SHA512 512-bit digests</li>
<li><a class="el" href="smdevp_8h.html#a647cb5d798442d34c8191c62a2aeebf6">SOAP_SMD_SIGN_DSA_SHA1</a> to compute DSA-SHA1 signatures</li>
<li><a class="el" href="smdevp_8h.html#adc47896cc5357888c4fe43825f86c783">SOAP_SMD_SIGN_DSA_SHA224</a> to compute DSA-SHA224 signatures</li>
<li><a class="el" href="smdevp_8h.html#abb7046ffa72e2deade72d960fb2c1272">SOAP_SMD_SIGN_DSA_SHA256</a> to compute DSA-SHA256 signatures</li>
<li><a class="el" href="smdevp_8h.html#ab100622cd77c0d3078c5f02f19bb6790">SOAP_SMD_SIGN_DSA_SHA384</a> to compute DSA-SHA384 signatures</li>
<li><a class="el" href="smdevp_8h.html#acdc41df17393ee4e42ad76245a5c3700">SOAP_SMD_SIGN_DSA_SHA512</a> to compute DSA-SHA512 signatures</li>
<li><a class="el" href="smdevp_8h.html#acbb90951064d98a13af03724dbed2aa8">SOAP_SMD_SIGN_RSA_SHA1</a> to compute RSA-SHA1 signatures</li>
<li><a class="el" href="smdevp_8h.html#afe09714e9ac82800fcc0929b017d5a04">SOAP_SMD_SIGN_RSA_SHA224</a> to compute RSA-SHA224 signatures</li>
<li><a class="el" href="smdevp_8h.html#a8634e2291f274a42107d3e935add3241">SOAP_SMD_SIGN_RSA_SHA256</a> to compute RSA-SHA256 signatures</li>
<li><a class="el" href="smdevp_8h.html#a46d8a09a01283fb765e09a19c3289aea">SOAP_SMD_SIGN_RSA_SHA384</a> to compute RSA-SHA384 signatures</li>
<li><a class="el" href="smdevp_8h.html#a47b63295eb2fd010886c3a2521090f02">SOAP_SMD_SIGN_RSA_SHA512</a> to compute RSA-SHA512 signatures</li>
<li><a class="el" href="smdevp_8h.html#a448c4d5953ca007263ff6a5bd055cfdc">SOAP_SMD_VRFY_DSA_SHA1</a> to verify DSA-SHA1 signatures</li>
<li><a class="el" href="smdevp_8h.html#ac99358e8d65c468a390ee12a7698c74c">SOAP_SMD_VRFY_DSA_SHA224</a> to verify DSA-SHA224 signatures</li>
<li><a class="el" href="smdevp_8h.html#a5b4e9a64ef8a1de550cc5c5ab889d3c6">SOAP_SMD_VRFY_DSA_SHA256</a> to verify DSA-SHA256 signatures</li>
<li><a class="el" href="smdevp_8h.html#a1584ce8cfcb9e6423b1768b3ac3346b6">SOAP_SMD_VRFY_DSA_SHA384</a> to verify DSA-SHA384 signatures</li>
<li><a class="el" href="smdevp_8h.html#a6ccc62ed11f8753cfd1aca15f1da51de">SOAP_SMD_VRFY_DSA_SHA512</a> to verify DSA-SHA512 signatures</li>
<li><a class="el" href="smdevp_8h.html#aa395a40932c9c057cd264c03716c9d6e">SOAP_SMD_VRFY_RSA_SHA1</a> to verify RSA-SHA1 signatures</li>
<li><a class="el" href="smdevp_8h.html#aa5d9d36c2db3bbef1dfd66593240cf16">SOAP_SMD_VRFY_RSA_SHA224</a> to verify RSA-SHA224 signatures</li>
<li><a class="el" href="smdevp_8h.html#ac495716c1f8630567900c33cdea08fd1">SOAP_SMD_VRFY_RSA_SHA256</a> to verify RSA-SHA256 signatures</li>
<li><a class="el" href="smdevp_8h.html#afec4c06d2b78ff9a4451a311849d7275">SOAP_SMD_VRFY_RSA_SHA384</a> to verify RSA-SHA384 signatures</li>
<li><a class="el" href="smdevp_8h.html#a16e7c5ef33465656c0d270eebc933021">SOAP_SMD_VRFY_RSA_SHA512</a> to verify RSA-SHA512 signatures</li>
</ul>
<p>Algorithm options:</p>
<ul>
<li><a class="el" href="smdevp_8h.html#a72aec9a04db9a1e00d26b1ccb5e5da03">SOAP_SMD_PASSTHRU</a> to pass XML through the smdevp engine</li>
</ul>
<p>The smdevp engine wraps the EVP API with three new functions:</p>
<ul>
<li><a class="el" href="smdevp_8c.html#a541d1b8b574a198bfa6fc06058c5923c">soap_smd_init</a> to initialize the engine</li>
<li><a class="el" href="smdevp_8c.html#a360fb1000a8dae32937075f300eb89d1">soap_smd_update</a> to update the state with a message part</li>
<li><a class="el" href="smdevp_8c.html#ab0ebb72766060a46872b2a337b209556">soap_smd_final</a> to compute the digest, signature, or verify a signature and to deallocate the engine</li>
<li><a class="el" href="smdevp_8c.html#a60c2bf254b7ed372f31c1da3de594c64">soap_smd_cleanup</a> to deallocate the engine</li>
</ul>
<p>A higher-level interface for computing (signed) message digests over messages produced by the gSOAP engine is defined by two new functions:</p>
<ul>
<li><a class="el" href="smdevp_8c.html#a9a4c5b08a2b82b71cec93e7ceddb20ae">soap_smd_begin</a> to start a digest or signature computation/verification</li>
<li><a class="el" href="smdevp_8c.html#a0f3003d09b3e2d141c9d04b9e302adde">soap_smd_end</a> to finalize the digest or signature and clean up</li>
</ul>
<p>Compile all source codes with -DWITH_OPENSSL and link with ssl and crypto libraries.</p>
<p>Here is an example to sign an XML serialized C++ object using an RSA private key applied to the SHA digest of the serialized object:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="smdevp_8h.html">smdevp.h</a>&quot;</span></div><div class="line">ns__Object object;</div><div class="line"><span class="keywordtype">int</span> alg = <a class="code" href="smdevp_8h.html#acbb90951064d98a13af03724dbed2aa8">SOAP_SMD_SIGN_RSA_SHA1</a>;</div><div class="line">FILE *fd = fopen(<span class="stringliteral">&quot;key.pem&quot;</span>, <span class="stringliteral">&quot;r&quot;</span>);</div><div class="line">EVP_PKEY *key = PEM_read_PrivateKey(fd, NULL, NULL, <span class="stringliteral">&quot;password&quot;</span>);</div><div class="line"><span class="keywordtype">char</span> *sig = (<span class="keywordtype">char</span>*)soap_malloc(soap, <a class="code" href="smdevp_8h.html#a358684027d81577215163533f34b971f">soap_smd_size</a>(alg, key));</div><div class="line"><span class="keywordtype">int</span> siglen;</div><div class="line">fclose(fd);</div><div class="line"><span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#ad8b665c8e8844eca8916f4b16b0ce9c5">soap_smd_begin</a>(soap, alg, key, 0)</div><div class="line"> || soap_out_ns__Object(soap, <span class="stringliteral">&quot;ns:Object&quot;</span>, 0, &amp;<span class="keywordtype">object</span>, NULL))</div><div class="line">{</div><div class="line">  <a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, NULL, NULL); <span class="comment">// clean up</span></div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line">}</div><div class="line"><span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, sig, &amp;siglen))</div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line"><span class="keywordflow">else</span></div><div class="line">  ... <span class="comment">// sig contains RSA-SHA1 signature of length siglen </span></div><div class="line">EVP_PKEY_free(key);</div></div><!-- fragment --><p>Compile the gSOAP sources and your code with -DWITH_OPENSSL and link with OpenSSL libraries.</p>
<p>There is no XML output generated by this example, as the object is simply serialized to the smdevp engine. To actually pass the XML object through the smdevp engine and output it to a stream or file simultaneously, use the SOAP_SMD_PASSTHRU flag with the algorithm selection as follows:</p>
<div class="fragment"><div class="line">ns__Object object;</div><div class="line"><span class="keywordtype">int</span> alg = <a class="code" href="smdevp_8h.html#acbb90951064d98a13af03724dbed2aa8">SOAP_SMD_SIGN_RSA_SHA1</a>;</div><div class="line">FILE *fd = fopen(<span class="stringliteral">&quot;key.pem&quot;</span>, <span class="stringliteral">&quot;r&quot;</span>);</div><div class="line">EVP_PKEY *key = PEM_read_PrivateKey(fd, NULL, NULL, <span class="stringliteral">&quot;password&quot;</span>);</div><div class="line"><span class="keywordtype">char</span> *sig = (<span class="keywordtype">char</span>*)soap_malloc(soap, <a class="code" href="smdevp_8h.html#a358684027d81577215163533f34b971f">soap_smd_size</a>(alg, key));</div><div class="line"><span class="keywordtype">int</span> siglen;</div><div class="line">fclose(fd);</div><div class="line">soap-&gt;sendfd = open(<span class="stringliteral">&quot;object.xml&quot;</span>, O_CREAT | O_WRONLY, 0600); <span class="comment">// a file to save object to</span></div><div class="line"><span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#ad8b665c8e8844eca8916f4b16b0ce9c5">soap_smd_begin</a>(soap, alg | <a class="code" href="smdevp_8h.html#a72aec9a04db9a1e00d26b1ccb5e5da03">SOAP_SMD_PASSTHRU</a>, key, 0)</div><div class="line"> || soap_begin_send(soap)</div><div class="line"> || soap_out_ns__Object(soap, <span class="stringliteral">&quot;ns:Object&quot;</span>, 0, &amp;<span class="keywordtype">object</span>, NULL) <span class="comment">// save to &quot;object.xml&quot;</span></div><div class="line"> || soap_end_send(soap))</div><div class="line">{</div><div class="line">  <a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, NULL, NULL); <span class="comment">// clean up</span></div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line">}</div><div class="line"><span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, sig, &amp;siglen))</div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line"><span class="keywordflow">else</span></div><div class="line">  ... <span class="comment">// sig contains RSA-SHA1 signature of length siglen </span></div><div class="line">close(soap-&gt;sendfd);</div><div class="line">EVP_PKEY_free(key);</div></div><!-- fragment --><p>Note that we used soap_begin_send and soap_end_send to emit the XML to a stream. Each type also has a reader (e.g. soap_read_ns__Object) and writer (e.g. soap_write_ns__Object) that can be used instead as these include soap_begin_recv/soap_end_recv and soap_begin_send/soap_end_send call sequences.</p>
<p>To verify the signature of an object read from a stream or file, we pass it through the smdevp engine as follows:</p>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> *sig = ...;</div><div class="line"><span class="keywordtype">int</span> siglen = ...;</div><div class="line">ns__Object object;</div><div class="line"><span class="keywordtype">int</span> alg = <a class="code" href="smdevp_8h.html#aa395a40932c9c057cd264c03716c9d6e">SOAP_SMD_VRFY_RSA_SHA1</a>;</div><div class="line">FILE *fd = fopen(<span class="stringliteral">&quot;key.pem&quot;</span>, <span class="stringliteral">&quot;r&quot;</span>);</div><div class="line">EVP_PKEY *key;</div><div class="line"><span class="keywordflow">if</span> (...) <span class="comment">// key file contains public key?</span></div><div class="line">  key = PEM_read_PUBKEY(fd, NULL, NULL, NULL);</div><div class="line"><span class="keywordflow">else</span> <span class="comment">// key file contains certificate</span></div><div class="line">{</div><div class="line">  X509 *cert = PEM_read_X509(fd, NULL, NULL, NULL);</div><div class="line">  key = X509_get_pubkey(cert);</div><div class="line">  X509_free(cert);</div><div class="line">}</div><div class="line">fclose(fd);</div><div class="line">soap-&gt;recvfd = open(<span class="stringliteral">&quot;object.xml&quot;</span>, O_RDONLY);</div><div class="line"><span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#ad8b665c8e8844eca8916f4b16b0ce9c5">soap_smd_begin</a>(soap, alg, key, 0)</div><div class="line"> || soap_begin_recv(soap)</div><div class="line"> || soap_in_ns__Object(soap, <span class="stringliteral">&quot;ns:Object&quot;</span>, &amp;<span class="keywordtype">object</span>, NULL) == NULL</div><div class="line"> || soap_end_recv(soap))</div><div class="line">{</div><div class="line">  <a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, NULL, NULL); <span class="comment">// clean up</span></div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line">}</div><div class="line"><span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, sig, &amp;siglen))</div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line"><span class="keywordflow">else</span></div><div class="line">  ... <span class="comment">// sig verified, i.e. signed object was not changed</span></div><div class="line">close(soap-&gt;recvfd);</div><div class="line">EVP_PKEY_free(key);</div></div><!-- fragment --><p>To verify the signature of an object stored in memory, we use the RSA public key and re-run the octet stream (by re-serialization in this example) through the smdevp engine using the SOAP_SMD_VRFY_RSA_SHA1 algorithm. Note that a PEM file may contain both the (encrypted) private and public keys.</p>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> *sig = ...;</div><div class="line"><span class="keywordtype">int</span> siglen = ...;</div><div class="line">ns__Object object;</div><div class="line"><span class="keywordtype">int</span> alg = <a class="code" href="smdevp_8h.html#aa395a40932c9c057cd264c03716c9d6e">SOAP_SMD_VRFY_RSA_SHA1</a>;</div><div class="line">FILE *fd = fopen(<span class="stringliteral">&quot;key.pem&quot;</span>, <span class="stringliteral">&quot;r&quot;</span>);</div><div class="line">EVP_PKEY *key;</div><div class="line"><span class="keywordflow">if</span> (...) <span class="comment">// key file contains public key?</span></div><div class="line">  key = PEM_read_PUBKEY(fd, NULL, NULL, NULL);</div><div class="line"><span class="keywordflow">else</span> <span class="comment">// key file contains certificate</span></div><div class="line">{</div><div class="line">  X509 *cert = PEM_read_X509(fd, NULL, NULL, NULL);</div><div class="line">  key = X509_get_pubkey(cert);</div><div class="line">  X509_free(cert);</div><div class="line">}</div><div class="line">fclose(fd);</div><div class="line"><span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#ad8b665c8e8844eca8916f4b16b0ce9c5">soap_smd_begin</a>(soap, alg, key, 0)</div><div class="line"> || soap_out_ns__Object(soap, <span class="stringliteral">&quot;ns:Object&quot;</span>, 0, &amp;<span class="keywordtype">object</span>, NULL))</div><div class="line">{</div><div class="line">  <a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, NULL, NULL); <span class="comment">// clean up</span></div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line">}</div><div class="line"><span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, sig, &amp;siglen))</div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line"><span class="keywordflow">else</span></div><div class="line">  ... <span class="comment">// sig verified, i.e. signed object was not changed</span></div><div class="line">EVP_PKEY_free(key);</div></div><!-- fragment --><p>The HMAC algorithm uses a shared secret key (hence both the sender and receiver must keep it secret) to sign and verify a message:</p>
<div class="fragment"><div class="line">ns__Object object;</div><div class="line"><span class="keywordtype">int</span> alg = <a class="code" href="smdevp_8h.html#a7d00704c43ee044926905cd327a712ef">SOAP_SMD_HMAC_SHA1</a>;</div><div class="line"><span class="keyword">static</span> <span class="keywordtype">char</span> key[16] =</div><div class="line">{ 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,</div><div class="line">  0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00 };</div><div class="line"><span class="keywordtype">char</span> *sig = (<span class="keywordtype">char</span>*)soap_malloc(soap, <a class="code" href="smdevp_8h.html#a358684027d81577215163533f34b971f">soap_smd_size</a>(alg, NULL));</div><div class="line"><span class="keywordtype">int</span> siglen;</div><div class="line"><span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#ad8b665c8e8844eca8916f4b16b0ce9c5">soap_smd_begin</a>(soap, alg, key, <span class="keyword">sizeof</span>(key))</div><div class="line"> || soap_out_ns__Object(soap, <span class="stringliteral">&quot;ns:Object&quot;</span>, 0, &amp;<span class="keywordtype">object</span>, NULL))</div><div class="line">{</div><div class="line">  <a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, NULL, NULL); <span class="comment">// clean up</span></div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line">}</div><div class="line"><span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, sig, &amp;siglen))</div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line"><span class="keywordflow">else</span></div><div class="line">  ... <span class="comment">// sig holds the signature</span></div></div><!-- fragment --><p>HMAC signature verification proceeds by recomputing the signature value for comparison.</p>
<p>A digest is a hash value of an octet stream computed using the MD5 or SHA algorithms:</p>
<div class="fragment"><div class="line">ns__Object object;</div><div class="line"><span class="keywordtype">int</span> alg = <a class="code" href="smdevp_8h.html#ad8bbfdd0e7b1656123d888bf86a516e9">SOAP_SMD_DGST_SHA1</a>;</div><div class="line"><span class="keywordtype">char</span> *digest = (<span class="keywordtype">char</span>*)soap_malloc(soap, <a class="code" href="smdevp_8h.html#a358684027d81577215163533f34b971f">soap_smd_size</a>(alg, NULL));</div><div class="line"><span class="keywordtype">int</span> digestlen;</div><div class="line"><span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#ad8b665c8e8844eca8916f4b16b0ce9c5">soap_smd_begin</a>(soap, alg, NULL, 0)</div><div class="line"> || soap_out_ns__Object(soap, <span class="stringliteral">&quot;ns:Object&quot;</span>, 0, &amp;<span class="keywordtype">object</span>, NULL))</div><div class="line">{</div><div class="line">  <a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, NULL, NULL); <span class="comment">// clean up</span></div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line">}</div><div class="line"><span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="smdevp_8h.html#a8f18dbae37de8942e080d45dd3480a7b">soap_smd_end</a>(soap, digest, &amp;digestlen))</div><div class="line">  soap_print_fault(soap, stderr);</div><div class="line"><span class="keywordflow">else</span></div><div class="line">  ... <span class="comment">// digest holds hash value of serialized object</span></div></div><!-- fragment --><p>Note that indentation (SOAP_XML_INDENT) and exc-c14n canonicalization (SOAP_XML_CANONICAL) affects the XML serialization format and, therefore, the digest or signature produced. </p>
</div></div><!-- contents -->
<hr class="footer">
<address class="footer">
Copyright (C) 2020, Robert van Engelen, Genivia Inc., All Rights Reserved.
</address>
<address class="footer"><small>
Converted on Thu Nov 19 2020 12:38:39 by <a target="_blank" href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.11</small></address>
<br>
<div style="height: 246px; background: #DBDBDB;">
</body>
</html>
